package com.chukun.disruptor.netty.client;

import com.chukun.disruptor.netty.bean.TranslatorData;
import com.chukun.disruptor.netty.disruptor.consumer.MessageConsumer;
import com.chukun.disruptor.netty.disruptor.entity.TranslatorDataWrapper;
import io.netty.util.ReferenceCountUtil;

/**
 * 服务端,业务逻辑处理
 */
public class NettyClientConsumer extends MessageConsumer {

    public NettyClientConsumer(String consumerID){
        super(consumerID);
    }

    @Override
    public void onEvent(TranslatorDataWrapper event) throws Exception {
        TranslatorData resp = event.getData();
        try {
            //1.业务逻辑处理
            System.err.println("received the response : id : " + resp.getId() + ", name: " + resp.getName() + ", message: " + resp.getMessage());
        }finally {
            ReferenceCountUtil.release(resp);
        }
    }
}
